package com.lheia.tool

import groovy.io.FileType

class ToolProperties {

    private static  properties=[:]
    static {
        File propertiesFold = new File("./properties")
        propertiesFold.eachFile(FileType.FILES,{
            def dataMap = [:]
            def props = new java.util.Properties()
            props.load( new FileInputStream(it) )
            Iterator iter = props.keys().iterator()
            while(iter.hasNext()){
                String key = iter.next()
                dataMap.put( key, props[key] )
            }
            properties.put(it.name.substring(0, it.name.lastIndexOf(".")),dataMap)
        })
    }
    static getProperties(def propertyPath){
        def propertis = new Properties()
        propertis = new java.util.Properties()
        propertis.load( new FileInputStream(propertyPath) )
        return propertis
    }
    static getGenerateProperties(){
        return properties.get("generate")
    }
}
